import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws ParseException {
        CloseableHttpClient htmlClient = HttpClientBuilder.create().build();
        CloseableHttpResponse htmlResponse = null;
        CloseableHttpClient imageClient = HttpClientBuilder.create().build();
        CloseableHttpResponse imageResponse = null;

        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMd");
        Date date = null;
        date = sdf.parse("2022411");
        Integer i = 0;
        while (i <= 30) {
            try {
                new DownloadThread(sdf.format(date)).start();
                Thread.sleep(1000);
                date = new Date(date.getTime() - (1000 * 60 * 60 * 24));
                i++;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
